<?php
/**
 * Student Dashboard: Notifications Tab
 *
 * @since 3.8.0
 * @version 3.30.3
 */

defined( 'ABSPATH' ) || exit;
?>

<div class="llms-sd-notification-center">

	<?php if ( isset( $notifications ) ) : ?>

		<?php if ( ! $notifications ) : ?>
			<div class="llms-sd-section__blank">
				<img src="<?php echo get_template_directory_uri(); ?>/assets/images/svg/my-notifications.svg" alt="Notifications" />
				<p><?php _e( 'You have no notifications.', 'buddyboss-theme' ); ?></p>
			</div>
		<?php else : ?>
			<ol class="llms-notification-list">
			<?php foreach ( $notifications as $noti ) : ?>
				<li class="llms-notification-list-item">
					<?php echo $noti->get_html(); ?>
				</li>
			<?php endforeach; ?>
			</ol>
		<?php endif; ?>

		<footer class="llms-sd-pagination llms-my-notifications-pagination">
			<nav class="llms-pagination">
			<?php
			echo paginate_links(
				array(
					'base'      => str_replace( 999999, '%#%', esc_url( get_pagenum_link( 999999 ) ) ),
					'format'    => '?page=%#%',
					'total'     => $pagination['max'],
					'current'   => $pagination['current'],
					'prev_next' => true,
					'prev_text' => '« ' . __( 'Previous', 'buddyboss-theme' ),
					'next_text' => __( 'Next', 'buddyboss-theme' ) . ' »',
					'type'      => 'list',
				)
			);
			?>
			</nav>
		</footer>

	<?php elseif ( isset( $settings ) ) : ?>

		<?php foreach ( $settings as $type => $triggers ) : ?>

			<h4><?php echo apply_filters( 'llms_notification_' . $type . '_title', $type ); ?></h4>
			<p><?php echo apply_filters( 'llms_notification_' . $type . '_desc', '' ); ?></p>
			<?php foreach ( $triggers as $id => $data ) : ?>
				<?php
				llms_form_field(
					array(
						'description' => '',
						'id'          => $id,
						'label'       => $data['name'],
						'last_column' => true,
						'name'        => 'llms_notification_pref[' . $type . '][' . $id . ']',
						'selected'    => ( 'yes' === $data['value'] ),
						'type'        => 'checkbox',
						'value'       => 'yes',
					)
				);
				?>
			<?php endforeach; ?>

		<?php endforeach; ?>

	<?php endif; ?>

</div>
